﻿using PARK.Common.Const;
using SqlSugar;
using System;
using Yitter.IdGenerator;

namespace PARK.Accessctl.Entitys
{
    /// <summary>
    /// 门禁记录
    /// </summary>
    [SugarTable("access_record")]
    [Tenant(ClaimConst.TENANT_ID)]
    public class AccessRecordEntity
    {
        /// <summary>
        /// 记录Id
        /// </summary>
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
        public string Id { get; set; }
        
        /// <summary>
        /// 门禁Id
        /// </summary>
        [SugarColumn(ColumnName = "ctlId")]        
        public string CtlId { get; set; }
        
        /// <summary>
        /// 门禁控制器SN
        /// </summary>
        [SugarColumn(ColumnName = "ctlSn")]        
        public string CtlSn { get; set; }
        /// <summary>
        /// 门禁控制器名称
        /// </summary>
        [SugarColumn(ColumnName = "ctlName")]
        public string ctlName { get; set; }
        /// <summary>
        /// 门禁记录索引
        /// </summary>
        [SugarColumn(ColumnName = "ctlInex")]        
        public string CtlInex { get; set; }
        
        /// <summary>
        /// 通行卡号
        /// </summary>
        [SugarColumn(ColumnName = "CardNo")]        
        public string CardNo { get; set; }
        /// <summary>
        /// 卡面卡号
        /// </summary>
        [SugarColumn(ColumnName = "CatCardNo")]
        public string CatCardNo { get; set; }        
        /// <summary>
        /// 通行时间
        /// </summary>
        [SugarColumn(ColumnName = "Passtime")]        
        public DateTime? Passtime { get; set; }
        
        /// <summary>
        /// 门Id
        /// </summary>
        [SugarColumn(ColumnName = "doorId")]        
        public string DoorId { get; set; }
        
        /// <summary>
        /// 门号 1,2,3,4
        /// </summary>
        [SugarColumn(ColumnName = "doorNo")]        
        public string DoorNo { get; set; }
        
        /// <summary>
        /// 门名称
        /// </summary>
        [SugarColumn(ColumnName = "doorName")]        
        public string DoorName { get; set; }
        
        /// <summary>
        /// 进出标记 1进 2出
        /// </summary>
        [SugarColumn(ColumnName = "InOrout")]        
        public int? InOrout { get; set; }
        
        /// <summary>
        /// 进出标记
        /// </summary>
        [SugarColumn(ColumnName = "InOroutName")]        
        public string InOroutName { get; set; }
        
        /// <summary>
        /// 状态  1通过 2禁止
        /// </summary>
        [SugarColumn(ColumnName = "PassStatus")]        
        public int? PassStatus { get; set; }
        
        /// <summary>
        /// 状态  （通过、禁止）
        /// </summary>
        [SugarColumn(ColumnName = "PassStatusName")]        
        public string PassStatusName { get; set; }
        
        /// <summary>
        /// 描述
        /// </summary>
        [SugarColumn(ColumnName = "Description")]        
        public string Description { get; set; }
        
        /// <summary>
        /// 人员Id
        /// </summary>
        [SugarColumn(ColumnName = "EmployeeId")]        
        public string EmployeeId { get; set; }
        
        /// <summary>
        /// 工号
        /// </summary>
        [SugarColumn(ColumnName = "JobNo")]        
        public string JobNo { get; set; }
        
        /// <summary>
        /// 姓名
        /// </summary>
        [SugarColumn(ColumnName = "ReallName")]        
        public string ReallName { get; set; }
        
        /// <summary>
        /// 部门Id
        /// </summary>
        [SugarColumn(ColumnName = "DepartId")]        
        public string DepartId { get; set; }
        
        /// <summary>
        /// 部门
        /// </summary>
        [SugarColumn(ColumnName = "DepartName")]        
        public string DepartName { get; set; }
        
        /// <summary>
        /// 是否用于考勤 默认 -1，1是 0否
        /// </summary>
        [SugarColumn(ColumnName = "IsAtt")]        
        public int? IsAtt { get; set; }
        
        /// <summary>
        /// 是否已同步至考勤 0否 1是
        /// </summary>
        [SugarColumn(ColumnName = "IsToAtt")]        
        public int? IsToAtt { get; set; }
        
        /// <summary>
        /// 排序码
        /// </summary>
        [SugarColumn(ColumnName = "SortCode")]        
        public long? SortCode { get; set; }
        
        /// <summary>
        /// 所在区域Id
        /// </summary>
        [SugarColumn(ColumnName = "doorAreaId")]        
        public string DoorAreaId { get; set; }
        
        /// <summary>
        /// 所在区域名称
        /// </summary>
        [SugarColumn(ColumnName = "doorAreaName")]        
        public string DoorAreaName { get; set; }
        
        /// <summary>
        /// 门禁位置
        /// </summary>
        [SugarColumn(ColumnName = "ctlposition")]        
        public string Ctlposition { get; set; }
        
        /// <summary>
        /// 
        /// </summary>
        [SugarColumn(ColumnName = "dbDate")]        
        public DateTime? DbDate { get; set; }

        /// <summary>
        /// 所属公司Id
        /// </summary>
        [SugarColumn(ColumnName = "CompanyId")]
        public string CompanyId { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        [SugarColumn(ColumnName = "CompanyName")]
        public string CompanyName { get; set; }

        /// <summary>
        /// 创建
        /// </summary>
        public virtual void Create()
        {
            this.Id = YitIdHelper.NextId().ToString();
            this.DbDate = DateTime.Now;
        }
    }
}